package com.web.hawaste.mapper;

import com.web.hawaste.domain.DetailDo;
import com.web.hawaste.entity.Detail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Suzy
 * @since 2022-09-26
 */
public interface DetailMapper extends BaseMapper<Detail> {
    @Select("SELECT\n" +
            "\tde.*,\n" +
            "\twt.CODE waste_type_code,\n" +
            "\twt.NAME waste_type_name,\n" +
            "\twa.CODE waste_code \n" +
            "FROM\n" +
            "\tdetail de,\n" +
            "\twaste_type wt,\n" +
            "\twaste wa \n" +
            "WHERE\n" +
            "\tde.work_order_id = #{oid}\n" +
            "\tAND de.waste_type_id = wt.id \n" +
            "\tAND de.waste_id = wa.id")
    List<DetailDo> selectByOrderId(Serializable oid);
}
